package nina.yiyou.performance.s11collect.input

import groovy.transform.PackageScope

@PackageScope
class EvalItemMaker {

  EvalItemMaker(String evaluateeId, String evaluateeName, String fillerId, String fillName,
                Map groupCol, List valueCol, int row) {
    _evaluateeId = evaluateeId
    _evaluateeName = evaluateeName
    _fillerId = fillerId
    _fillName = fillName
    _groupCol = groupCol
    _valueCol = valueCol
    _row = row
  }

  CollectFilledReader.Eval make() {
    return new CollectFilledReader.Eval() {
      @Override
      String evaluateeId() {
        return _evaluateeId.toString()
      }

      @Override
      String evaluateeName() {
        return _evaluateeName
      }

      @Override
      String fillerId() {
        return _fillerId
      }

      @Override
      String fillerName() {
        return _fillName
      }

      @Override
      String type() {
        return _valueCol[1]
      }

      @Override
      String group() {
        return _groupCol[_row]
      }

      @Override
      String key() {
        return null
      }

      @Override
      Object value() {
        return _valueCol[_row]
      }

      @Override
      String toString() {
        return "${fillerName()}->${evaluateeName()}:[${group()}(${value()})]"
      }
    }
  }

  private final String _evaluateeId
  private final String _evaluateeName

  private final String _fillerId
  private final String _fillName

  private final Map _groupCol
  private final List _valueCol

  private final int _row
}
